﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Blade.IO {
	public sealed class CountingNullStream : Stream {
		public override bool CanRead { get { return true; } }

		public override bool CanSeek { get { return false; } }

		public override bool CanWrite { get { return true; } }

		public override void Flush() {
		}

		public override long Length {
			get { return 0; }
		}

		public override long Position {
			get { return 0; }
			set { }
		}

		public override int Read(byte[] buffer, int offset, int count) {
			BytesRead += count;
			return count;
		}

		public override long Seek(long offset, SeekOrigin origin) {
			throw new NotSupportedException();
		}

		public override void SetLength(long value) {
			throw new NotSupportedException();
		}

		public override void Write(byte[] buffer, int offset, int count) {
			BytesWritten += count;
		}

		public int BytesRead { get; private set; }

		public int BytesWritten { get; private set; }

	}
}
